-- aid_attack1
-- created by wangy
-- 场上有某种怪物时，自身攻击+%

return {
    apply = function(prop, baseValue)
        return prop[2];
    end,

    -- 攻击触发
    trigger = function(who, prop, arg)
        local attack = arg;
        local aliveMonster = FormulaM.getAliveMonsters(true);
        local monster;

        -- 遍历当前存活怪物中是否有指定基类怪物
        for _, monster in pairs(aliveMonster) do
            -- 加攻击的
            if monster:query("base_class_id") == tonumber(prop[2]) then
                return attack + attack * prop[3] / 1000;
            end
        end

        return attack;
    end,

    record = function(target, prop, path)
        return false;
    end
};